package com.changil.nowonchangil.rest;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;

import net.coobird.thumbnailator.Thumbnails;

import com.changil.nowonchangil.controller.ServiceController;

@Path("/missions")
public class RestMission {
	private ServiceController controller = new ServiceController();

	public void SetScoreService(ServiceController controller) {
		this.controller = controller;
	}

	@GET
	@Path("/file")
	@Produces("image/png")
	public Image getFile() {
		URL url = null;
		try {
			url = new URL(
					"http://zeropol2.net63.net/image/NowonChangil/1-1.jpg");
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		BufferedImage thumbnail = null;
		try {
			thumbnail = Thumbnails.of(url).size(160, 160).asBufferedImage();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return thumbnail;
	}

	

}
